import { Component, OnInit, Injector } from '@angular/core';
import { ServiceProxy, LogisticsDTO } from '@shared/service-proxy/service-proxies';
import { AppComponentBase } from '@shared/common/app-component-base';

@Component({
  selector: 'app-logistic-detail-modal',
  templateUrl: './logistic-detail-modal.component.html',
  styleUrls: ['./logistic-detail-modal.component.less']
})
export class LogisticDetailModalComponent extends AppComponentBase implements OnInit {
  isVisible: boolean = false;
  logistic: LogisticsDTO;
  constructor(
    injector: Injector,
    private _service: ServiceProxy) {
      super(injector);
  }

  ngOnInit() {
    this.logistic = new LogisticsDTO();
  }

  show(id: string) {
    this.isVisible = true;
    this.getLogistic(id);
  }

  getLogistic(id: string) {
    this._service.searchLogisticsUsingGET(id).subscribe(result => {
      this.logistic = result.result;
    });
  }

  handleCancel() {
    this.isVisible = false;
  }

  handleOk() {
    this.isVisible = false;
  }
}
